package vn.edu.hcmut.cse.ai.search.problems.blocksworld.actiontype;

import vn.edu.hcmut.cse.ai.search.problems.blocksworld.predicate.ArmEmpty;
import vn.edu.hcmut.cse.ai.search.problems.blocksworld.predicate.Clear;
import vn.edu.hcmut.cse.ai.search.problems.blocksworld.predicate.Holding;
import vn.edu.hcmut.cse.ai.search.problems.blocksworld.predicate.On;

public class Unstack extends BinaryBlocksWorldActionType {

    public Unstack(int firstBlock, int secondBlock) {
        super(firstBlock, secondBlock);
        
        // Precondition list
        On onPred = new On(firstBlock, secondBlock);
        Clear clearPred = new Clear(firstBlock);
        ArmEmpty armEmptyPred = new ArmEmpty();    
        this.preConditionList.add(onPred);
        this.preConditionList.add(clearPred);
        this.preConditionList.add(armEmptyPred);
        
        // Add list       
        Holding holdingPred = new Holding(firstBlock);
        Clear clearPred2 = new Clear(secondBlock);
        this.addList.add(holdingPred);
        this.addList.add(clearPred2);
        
        // Remove this
        this.removeList.add(onPred);
        this.removeList.add(armEmptyPred);
    }
    
    
    @Override
    public String toString() {
        return "Unstack{" + this.firstBlock + ", " + this.secondBlock + '}';
    }
}
